// Sprite class that renders an animated sprite to the screen

#pragma once
#include "d3dUtil.h"
#include "SpriteData.h"

#define SPRITEFRAMERATE 20.0f

class Sprite
{
private:
	float				mScale;
	SpriteData			mSpriteData;
	ID3DXSprite			*mSprite;
	IDirect3DTexture9	*mTexture;
	float				mTimeElapsedSinceLastUpdate;
	float				mTimeElapsedTotal;
	int					mCurrentColumn;
	int					mCurrentRow;
	float				mLifeTime;
	int					mCurrentLoop;
	D3DXVECTOR3			mCenter;
	bool				mHasStopped;
	bool				mAlphaFade;
	int					mAlpha;

public:
	Sprite(ID3DXSprite *sprite, SpriteData &spriteData, float scale, float lifeTime, bool alphaFade = false);
	~Sprite();

	void Update(float dt);

	void Render(D3DXMATRIX &viewProj, D3DXVECTOR3 &pos, const D3DXMATRIX &rot);

	bool HasStopped(void)
	{
		return mHasStopped;
	}

};